import store from '@/store'

/**
* v-auth 自定义权限按钮指令
* v-auth:every 每个权限都需要满足
* v-auth:some 部分权限需要满足
*/

const auth = (el, binding) => {
  const valueArr = binding.value
  const roles = store.getters.roles
  let rules = true
  rules = valueArr.some(item => {
    return roles.includes(item)
  })
  !rules && el.parentNode.removeChild(el)
}

export default auth
